/**
 * title: A1
 * Routes:
 *   - ./src/routes/a.js
 *   - ./src/routes/b.js
 */
import styles from './a1.css';
import Link from 'umi/link';
import router from 'umi/router';
// import {connect} from 'dva'
import { dynamic } from 'umi';

const timeout = t => new Promise(resolve => setTimeout(resolve, t));

const A1 = dynamic({
  loader: async () => {
    await timeout(1000);
    return () => {
      return (
        <div className={styles.normal}>
          <h1>Page a1</h1>
          <Link to="/a2">a2</Link>
          <div
            onClick={() => {
              router.push('/a2');
            }}
          >
            a2
          </div>
        </div>
      );
    };
  },
});

// function A1(props) {
//   return (
//     <div className={styles.normal}>
//       <h1>Page a1</h1>
//       <Link to='/a2'>a2</Link>
//       <div onClick={()=>{
//         router.push('/a2')
//       }}>a2</div>
//     </div>
//   );
// }

export default A1;
